<?php
$mu = Session::get('mu');
$menuManage = new Model('pc_menu_manage');
// $menu = json_decode($menuManage->menu,1);
//$menuArr = ['index'=>'首页','zhishi'=>'知识付费','live'=>'直播课堂','list'=>'新闻资讯','agent'=>'代理加盟','about'=>'关于我们','one'=>'预留菜单','two'=>'预留菜单'];
// $menuArr = ['one'=>'预留菜单'];
$type = Request::get(1);
if($type == 'add'){
	$menuManage->pid = $mu->id;
	$menuManage->name = Request::post('name');
	$menuManage->url = Request::post('url');
	$menuManage->ctime = time(); 
	if($menuManage->save()){
		Response::write('ok');
	}
	Response::write('no');
}else if($type == 'del'){
	$id = Request::post('id');
	$menu_del = (new Model('pc_menu_manage'))->find($id);
	if(!$menu_del->id){
		Response::write('no');
	}
	if($menu_del->delete()){
		Response::write('ok');
	}
	Response::write('no');
}
